<template>
	<view class="container">
		<form @submit="formSubmit" @reset="formReset">
			<view class="section">
				<view class="section__title">原始体重(kg):</view>
				<span>{{heathInfo.originW}}</span>
			</view>
			<view class="section">
				<view class="section__title">目标体重(kg):</view>
				<span>{{heathInfo.targetW}}</span>
			</view>
			<view class="section">
				<view class="section__title">昨日饮食(kg):</view>
				<span>{{heathInfo.yesterdayFood}}</span>
			</view>
			
			<view class="section">
				<view class="section__title">➊早餐:</view>
				<span>{{heathInfo.breakfisrt}}</span>
			</view>
		
			<view class="section">
				<view class="section__title">➋午餐: </view>
				<span>{{heathInfo.lunch}}</span>
			</view>
			<view class="section">
				<view class="section__title">➌晚餐: </view>
				<span>{{heathInfo.dinner}}</span>
			</view>
			<view class="section">
				<view class="section__title">饮水量共(ML):</view>
				<span>{{heathInfo.drink}}</span>
			</view>
			<view class="section">
				<view class="section__title">排便情况：</view>
				<span>{{heathInfo.defecation}}</span>
			</view>
		
			<view class="section section_gap">
				<view class="section__title">昨日体重(kg):</view>
				<span>{{heathInfo.yesterdayW}}</span>
			</view>
			<view class="section section_gap">
				<view class="section__title">今日体重(kg):</view>
				<span>{{heathInfo.todayW}}</span>
			</view>
			<view class="section section_gap">
				<view class="section__title">对比昨日(kg):</view>
				<span>{{heathInfo.constrat4yesterday}}</span>
			</view>
			<view class="section section_gap">
				<view class="section__title">累计天数:</view>
				<span>{{heathInfo.totalDay}}</span>
			</view>
			<view class="section section_gap">
				<view class="section__title">累计降重(kg):</view>
				<span>{{heathInfo.totalKillFat}}</span>
			</view>
		</form>
	</view>
</template>

<script>
	import historyData from './history.js'
	export default {
		data() {
			return {
				heathInfo: historyData
			};
		},
		methods: {
			getInfoList: function(){
				uni.showModal({
					title: '信息',
					content: '开始获取历史信息了'
					
				})
				uni.request({
				    url: 'http://01b57cef.ngrok.io/users/getUserInfo', //检查更新的服务器地址
					// url: 'http://www.shangdihuayu.top/tiantainbeishengjingJDK7/scriptureAction/searchScripturesByDate.action',
				    data: { 
				        type: 'A',
						createDate: '2019-09-05',
						id: 1
				    },
					method: 'GET',
				    success: (res) => {
				        console.log('success', res);
						uni.showToast({
							title: '获取健身信息成功O(∩_∩)O',
				        })
						this.heathInfo = res.data
				    },
					fail: (res) => {
						console.log(res)
					}
				})
			}
		},
		mounted() {
			this.getInfoList()
		}
	}
</script>

<style lang="scss">
	.container{
		margin-left: 10upx;
		margin-right: 10upx;
		.section{
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			font-size: 30upx;
			margin-top: 4upx;
			color: #808080;
			.section__title{
				width: 260upx;
				text-align: right;
				font-size: 34upx;
			}
			
		}
	}
	
</style>
